<!-- reportingResults -->
<template>
    <div class="page">
        <!-- 导航栏 -->
        <div class="navBar">
            <customNavBar @goBack="goreportingJst()" :leftTetx=leftTetx :titleTest=titleTest></customNavBar>
        </div>
        <!-- <div style="text-align: left; padding-left: 13px; margin-top: 30px;" @click="goreportingJst()">
         <img class='contentg' src="../../assets/img/features/closeIcon.png" alt="">
        </div> -->
        <!-- <div class='cetjecsty'>
        <span >报告生成结果</span> 
        </div> -->
        <!-- 页面内容 -->
        <div class="pageContent">
            <div class="content">
                <div style="margin-top: 61px;">
                    <van-image width=46vw height=38vw :src="viewReport" />
                </div>
                <div class='progress'>
                    您勾选的部分保单数据待补充，本次生成的报告中无法展示，是否继续生成报告？
                    <!-- 您勾选的部分保单数据未找到，将无法在报告中展示。是否为您继续生成报告？ -->
                    <!-- <span>【保单数量不一致】</span>，是否生成报告？ -->
                </div>
            </div>
            <div class='botto'>
                <div @click="goletterAdvce()">是</div>
                <div @click="goreportingResultcsb()">否</div>
            </div>
        </div>
    </div>
    <div class='pageBj' v-if="showDialog">
        <div class="pageBjDiv">
            <div class='pageBjDivHeader'>温馨提示</div>
            <div class='pageBjDivsection'>您确认要退出本次服务吗?</div>
            <div class="pageBjDivBtoom">
                <div @click="onConfirm()">继续退出</div>
                <div @click="onCancel()">取消</div>
            </div>
        </div>
    </div>
</template>

<script lang="ts" setup name="reportingResultsbyz">
import { useRouter, useRoute } from "vue-router"
import { Toast } from '/@/utils/Message';
import { onMounted } from "vue"
import { reactive, ref } from 'vue'
import { updateReportStatus,SpeciallyValidateUserID } from "/@/api/auth/repot"
import customNavBar from "/src/components/NavBar/customNavBar.vue"
import viewReport from "../../assets/img/tast/repotByz.png"

const router = useRouter()
const route = useRoute()
const leftTetx = ref("")
const titleTest = ref("报告生成结果")
const showDialog = ref<boolean>(false)
let data = reactive({
    ...route.query,
});
const onConfirm = () => {
    // window.location.replace('./reportingResultwxts')
    router.push({ path: 'reportingResultwxts' })
}
const onCancel = () => {
    // 取消操作
    showDialog.value = false;
}
const goreportingJst = (): void => {
    showDialog.value = true
}
const goletterAdvce = () => {
    // 15 部分成功
    updateReportStatus({ ...data, status: "15" }).then((res: any) => {
        if (res.code == 200) {
            router.push({ path: '/reportingResultxysc', query: { taskCode: res.taskCode, reportCode: res.reportCode } })
            // router.push({ path: '/reportingResultsysc', query: { taskCode: res.taskCode, reportCode: res.reportCode } })
        }
    })
}
const goreportingResultcsb = () => {
    // 部分失败
    updateReportStatus({ ...data, status: "16" }).then((res: any) => {
        if (res.code == 200) {
            router.push({ path: '/reportingResultcsb', query: { taskCode: res.taskCode, reportCode: res.reportCode, errCode: data.errCode } })
        }
    })
}
onMounted(async () => {
    SpeciallyValidateUserID().then((res: any) => {
        if (res.code == 402) {
         router.push({ path: 'reportingResultwxts' })
        }
    })
})
const backHome = () => {

    // 获取 User Agent
    var userAgent = navigator.userAgent.toLowerCase();
    // 判断是否在微信中打开
    if (userAgent.indexOf('micromessenger') !== -1) {
        setTimeout(function () {
            //这个可以关闭安卓系统的手机
            document.addEventListener(
                "WeixinJSBridgeReady",
                function () {
                    WeixinJSBridge.call("closeWindow");
                },
                false
            );
            //这个可以关闭ios系统的手机
            WeixinJSBridge.call("closeWindow");
        }, 500);
    } else {
        console.log('当前页面不在微信中打开');
        if (userAgent.indexOf("Firefox") != -1 || userAgent.indexOf("Chrome") != -1) {
            window.location.href = "about:blank";
        } else if (userAgent.indexOf('Android') > -1 || userAgent.indexOf('Linux') > -1) {
            window.opener = null; window.open('about:blank', '_self', '').close();
        } else {
            window.opener = null;
            window.open("about:blank", "_self");
            window.close();
        }
    }
}
</script>

<!-- less嵌套设置 -->
<style lang="less" scoped>
.pageBj {
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    position: absolute;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);

    .pageBjDiv {
        width: 300px;
        // padding: 10px 20px;
        border-radius: 10px;
        background: #ffffff;

        .pageBjDivHeader {
            margin-top: 17px;
            font-size: 14px;
            font-weight: bold;
        }

        .pageBjDivsection {
            margin-top: 17px;
            font-size: 13px;
        }

        .pageBjDivBtoom {
            display: flex;
            width: 100%;
            margin-top: 17px;
            justify-content: center;
            border-top: 1px solid #f3f3f3;

            div {
                padding: 10px 0;
                width: 50%;
            }

            div:last-child {
                color: #ffffff;
                background: #2c56ce;
                border-bottom-right-radius: 7px;
            }
        }
    }
}

.contentg {
    width: 30px;
    height: 27px;
}

.page {
    background-color: #FFFFFF;
    width: 100vw;

    .pageContent {
        margin-top: 52px;
        // background-color: #f7f8fa;
        padding-bottom: 40px;

        .content {
            width: 100%;
            padding-top: 68px;
            overflow: hidden;

            .progress {
                // width: 340px;
                width:98%;
                font-size: 14px;
                margin-top: 36px;
                text-align: left;
                margin: 0 auto;
                padding: 12px;
                span {
                    color: #007DFA;
                    font-weight: bold;
                }
            }
        }

        .botto {
            display: flex;
            margin-top: 100px;
            align-items: center;
            justify-content: center;

            div {
                width: 153px;
                height: 50px;
                display: flex;
                color: #298BF0;
                align-items: center;
                justify-content: center;
                background: url(../../assets/img/tast/xyb.png);
                background-size: 100% 100%;
                background-repeat: no-repeat;
            }
        }
    }
}
</style>
